<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>Some new features of xmake v2.1.5</title>
    <meta name="description" content="find_packageThis interface refers to the design of CMake for the find_* interfaces, which finds and adds package dependencies in the project target.target("t...">

    
    <meta name="keywords" content="xmake,lua,cmake,detect,compiler,features,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/2017/07/29/new-features-v2.1.5/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/cn?lang=0">
                    
                        <i class="fa fa-home"></i>中文
                    </a>
                </li>

                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>Projects
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/archive/">
                            
                        
                            <i class="fa fa-archive"></i>Archives
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/category/">
                            
                        
                            <i class="fa fa-th-list"></i>Categories
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/tag/">
                            
                        
                            <i class="fa fa-tags"></i>Tags
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/docs/">
                            
                        
                            <i class="fa fa-book"></i>Documents
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="https://xmake.io/#/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>Community
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/donation/">
                            
                        
                            <i class="fa fa-heart"></i>Donate
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/about/">
                            
                        
                            <i class="fa fa-user"></i>About
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                     
                     
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>Some new features of xmake v2.1.5</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2017-07-29
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#cmake" title="Tag: cmake" rel="tag">cmake</a-->
        <a href="/tag/#cmake" title="Tag: cmake" rel="tag">cmake</a>&nbsp;
    
        <!--a href="/tag/#detect" title="Tag: detect" rel="tag">detect</a-->
        <a href="/tag/#detect" title="Tag: detect" rel="tag">detect</a>&nbsp;
    
        <!--a href="/tag/#compiler" title="Tag: compiler" rel="tag">compiler</a-->
        <a href="/tag/#compiler" title="Tag: compiler" rel="tag">compiler</a>&nbsp;
    
        <!--a href="/tag/#features" title="Tag: features" rel="tag">features</a-->
        <a href="/tag/#features" title="Tag: features" rel="tag">features</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <h4 id="find_package">find_package</h4>

<p>This interface refers to the design of CMake for the <code class="highlighter-rouge">find_*</code> interfaces, which finds and adds package dependencies in the project target.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">on_load</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.find_package"</span><span class="p">)</span>
        <span class="n">target</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="n">find_package</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">))</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="package-dependency-management-20">Package Dependency Management 2.0</h4>

<p>Now through <code class="highlighter-rouge">find_package</code> and <code class="highlighter-rouge">option</code>, we can achieve better package management.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">option</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">)</span>
    <span class="n">set_showmenu</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span>
    <span class="n">before_check</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">option</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.find_package"</span><span class="p">)</span>
        <span class="n">option</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="n">find_package</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">))</span>
    <span class="k">end</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_options</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">)</span>
</code></pre>
</div>

<p>If you want to manually disable this zlib package and automatic detection and linking, you only need:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f --zlib<span class="o">=</span>n 
<span class="gp">$ </span>xmake
</code></pre>
</div>

<p>Note: We will implement package management 3.0 in the 2.2.1 version, if you want to known more info, please see：<a href="https://github.com/xmake-io/xmake/issues/69">Remote package management</a>。</p>

<p>For example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"mbedtls master optional"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"pcre2 &gt;=1.2.0"</span><span class="p">,</span> <span class="s2">"zlib &gt;= 1.2.11"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"git@github.com:glennrp/libpng.git@libpng &gt;=1.6.28"</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"pcre2"</span><span class="p">,</span> <span class="s2">"zlib"</span><span class="p">,</span> <span class="s2">"libpng"</span><span class="p">,</span> <span class="s2">"mbedtls"</span><span class="p">)</span>
</code></pre>
</div>

<p>We are currently working to develop …</p>

<h4 id="custom-extensions-for-modules">Custom Extensions for Modules</h4>

<p>We can specify the extended modules directory in the project file (<code class="highlighter-rouge">xmake.lua</code>):</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_moduledirs</span><span class="p">(</span><span class="s2">"$(projectdir)/xmake/modules"</span><span class="p">)</span>
</code></pre>
</div>

<p>And add custom <code class="highlighter-rouge">detect.package.find_openssl</code> module to this directory.</p>

<div class="highlighter-rouge"><pre class="highlight"><code>projectdir
 - xmake
   - modules
     - detect/package/find_openssl.lua
</code></pre>
</div>

<p>Now we can get more package info about openssl by <code class="highlighter-rouge">lib.detect.find_package("openssl")</code>.</p>

<p>The search order of <code class="highlighter-rouge">find_package</code>:</p>

<ol>
  <li>Find the local package “openssl.pkg” from the argument <code class="highlighter-rouge"><span class="p">{</span><span class="err">packagedirs</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nt">"./pkg"</span><span class="err">}</span></code></li>
  <li>Call <code class="highlighter-rouge">detect.packages.find_openssl</code> to find it from the custom module directory <code class="highlighter-rouge">xmake/modules</code>in the project.</li>
  <li>If <code class="highlighter-rouge">pkg-config</code> exists in the current system, we can use it to get more info and find it.</li>
  <li>If <code class="highlighter-rouge">homebrew</code> exists in the current system, we can use <code class="highlighter-rouge">brew --prefix openssl</code> to get more info and find it.</li>
  <li>Find it from the some system library directories, .e.g <code class="highlighter-rouge">/usr/lib</code>, <code class="highlighter-rouge">/usr/include</code></li>
</ol>

<h4 id="fast-compiler-feature-detection-support">Fast compiler feature detection support</h4>

<p>This is also a reference to the design of CMake, details see: <a href="https://github.com/xmake-io/xmake/issues/83">issues#83</a>。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">on_load</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.tool.compiler"</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">compiler</span><span class="p">.</span><span class="n">has_features</span><span class="p">(</span><span class="s2">"cxx_constexpr"</span><span class="p">)</span> <span class="k">then</span>
            <span class="n">target</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="s2">"defines"</span><span class="p">,</span> <span class="s2">"HAS_CXX_CONSTEXPR=1"</span><span class="p">)</span>
        <span class="k">end</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>We can also add some parameters to control the compilation option for detection.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="n">compiler</span><span class="p">.</span><span class="n">has_features</span><span class="p">({</span><span class="s2">"c_static_assert"</span><span class="p">,</span> <span class="s2">"cxx_constexpr"</span><span class="p">},</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"cxx11"</span><span class="p">})</span> <span class="k">then</span>
    <span class="c1">-- ok</span>
<span class="k">end</span>
</code></pre>
</div>

<p>Even we can pass the target and inherit all of it’s compiled configuration.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="n">compiler</span><span class="p">.</span><span class="n">has_features</span><span class="p">(</span><span class="s2">"cxx_constexpr"</span><span class="p">,</span> <span class="p">{</span><span class="n">target</span> <span class="o">=</span> <span class="n">target</span><span class="p">,</span> <span class="n">defines</span> <span class="o">=</span> <span class="s2">".."</span><span class="p">,</span> <span class="n">includedirs</span> <span class="o">=</span> <span class="s2">".."</span><span class="p">})</span> <span class="k">then</span>
    <span class="c1">-- ok</span>
<span class="k">end</span>
</code></pre>
</div>

<h4 id="detect-specified-cc-headers">Detect specified c/c++ headers</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.has_cincludes"</span><span class="p">)</span>

<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_cincludes</span><span class="p">(</span><span class="s2">"stdio.h"</span><span class="p">)</span>
<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_cincludes</span><span class="p">({</span><span class="s2">"stdio.h"</span><span class="p">,</span> <span class="s2">"stdlib.h"</span><span class="p">},</span> <span class="p">{</span><span class="n">target</span> <span class="o">=</span> <span class="n">target</span><span class="p">})</span>
</code></pre>
</div>

<p>The interface of c++ is <code class="highlighter-rouge">has_cxxincludes</code>:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.has_cxxincludes"</span><span class="p">)</span>

<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_cxxincludes</span><span class="p">({</span><span class="s2">"stdio.h"</span><span class="p">,</span> <span class="s2">"stdlib.h"</span><span class="p">},</span> <span class="p">{</span><span class="n">defines</span> <span class="o">=</span> <span class="s2">"_GNU_SOURCE=1"</span><span class="p">,</span> <span class="n">languages</span> <span class="o">=</span> <span class="s2">"cxx11"</span><span class="p">})</span>
</code></pre>
</div>

<h4 id="detect-specified-cc-functions">Detect specified c/c++ functions</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.has_cfuncs"</span><span class="p">)</span>

<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_cfuncs</span><span class="p">(</span><span class="s2">"setjmp"</span><span class="p">)</span>
<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_cfuncs</span><span class="p">({</span><span class="s2">"sigsetjmp((void*)0, 0)"</span><span class="p">,</span> <span class="s2">"setjmp"</span><span class="p">},</span> <span class="p">{</span><span class="n">includes</span> <span class="o">=</span> <span class="s2">"setjmp.h"</span><span class="p">})</span>
</code></pre>
</div>

<p>The interface of c++ is <code class="highlighter-rouge">has_cxxfuncs</code>.</p>

<h4 id="detect-specified-cc-types">Detect specified c/c++ types</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.has_ctypes"</span><span class="p">)</span>

<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_ctypes</span><span class="p">(</span><span class="s2">"wchar_t"</span><span class="p">)</span>
<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_ctypes</span><span class="p">({</span><span class="s2">"char"</span><span class="p">,</span> <span class="s2">"wchar_t"</span><span class="p">},</span> <span class="p">{</span><span class="n">includes</span> <span class="o">=</span> <span class="s2">"stdio.h"</span><span class="p">})</span>
<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">has_ctypes</span><span class="p">(</span><span class="s2">"wchar_t"</span><span class="p">,</span> <span class="p">{</span><span class="n">includes</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"stdio.h"</span><span class="p">,</span> <span class="s2">"stdlib.h"</span><span class="p">},</span> <span class="s2">"defines = "</span><span class="n">_GNU_SOURCE</span><span class="o">=</span><span class="mi">1</span><span class="s2">", languages = "</span><span class="n">cxx11</span><span class="s2">"})
</span></code></pre>
</div>

<p>The interface of c++ is <code class="highlighter-rouge">has_cxxtypes</code>.</p>

<h4 id="check-specified-cc-snippets">Check specified c/c++ snippets</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.check_cxsnippets"</span><span class="p">)</span>

<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">check_cxsnippets</span><span class="p">(</span><span class="s2">"void test() {}"</span><span class="p">)</span>
<span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">check_cxsnippets</span><span class="p">({</span><span class="s2">"void test(){}"</span><span class="p">,</span> <span class="s2">"#define TEST 1"</span><span class="p">},</span> <span class="p">{</span><span class="n">types</span> <span class="o">=</span> <span class="s2">"wchar_t"</span><span class="p">,</span> <span class="n">includes</span> <span class="o">=</span> <span class="s2">"stdio.h"</span><span class="p">})</span>
</code></pre>
</div>

<p>And we can pass some detection condition (types, functions, includes, and links).</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="kd">local</span> <span class="n">ok</span> <span class="o">=</span> <span class="n">check_cxsnippets</span><span class="p">(</span><span class="s2">"void test() {}"</span><span class="p">,</span> <span class="p">{</span><span class="n">types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"wchar_t"</span><span class="p">,</span> <span class="s2">"char*"</span><span class="p">},</span> <span class="n">includes</span> <span class="o">=</span> <span class="s2">"stdio.h"</span><span class="p">,</span> <span class="n">funcs</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"sigsetjmp"</span><span class="p">,</span> <span class="s2">"sigsetjmp((void*)0, 0)"</span><span class="p">}})</span>
</code></pre>
</div>

<h4 id="quick-test-module-interface">Quick Test Module interface</h4>

<p>The <code class="highlighter-rouge">xmake lua</code> plugin has supported REPL (READ-EVAL-PRINT) to test modules in 2.1.4 version:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake lua
<span class="gp">&gt; </span>1 + 2
3

<span class="gp">&gt; </span>a <span class="o">=</span> 1
<span class="gp">&gt; </span>a
1

<span class="gp">&gt; </span><span class="k">for </span>_, v <span class="k">in </span>pairs<span class="o">({</span>1, 2, 3<span class="o">})</span> <span class="k">do</span>
<span class="gp">&gt;&gt; </span>print<span class="o">(</span>v<span class="o">)</span>
<span class="gp">&gt;&gt; </span>end
1
2
3
</code></pre>
</div>

<p>we can now test the module interface more quickly through a line of commands:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake lua lib.detect.find_package openssl
</code></pre>
</div>

<p>The results: <code class="highlighter-rouge"><span class="p">{</span><span class="err">links</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">{</span><span class="nt">"ssl"</span><span class="err">,</span><span class="w"> </span><span class="nt">"crypto"</span><span class="err">,</span><span class="w"> </span><span class="nt">"z"</span><span class="err">},</span><span class="w"> </span><span class="err">linkdirs</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="p">{</span><span class="nt">"/usr/local/lib"</span><span class="err">},</span><span class="w"> </span><span class="err">includedirs</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="p">{</span><span class="nt">"/usr/local/include"</span><span class="err">}}</span></code></p>

<h4 id="precompiled-header-file-support">Precompiled header File Support</h4>

<p>We can add a precompiled header file to speed up the c/c++ program compile, currently supported compilers are: gcc, clang and msvc.</p>

<p>Set c precompiled header:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_pcheader</span><span class="p">(</span><span class="s2">"header.h"</span><span class="p">)</span>
</code></pre>
</div>

<p>Set c++ precompiled header:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_pcxxheader</span><span class="p">(</span><span class="s2">"header.h"</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="generate-compiler_commandsjson">Generate compiler_commands.json</h4>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> project -k compile_commands
</span></code></pre>
</div>

<p>The output content like:</p>

<div class="highlighter-rouge"><pre class="highlight"><code>[
  { "directory": "/home/user/llvm/build",
    "command": "/usr/bin/clang++ -Irelative -DSOMEDEF=\"With spaces, quotes and \\-es.\" -c -o file.o file.cc",
    "file": "file.cc" },
  ...
]

</code></pre>
</div>

<p>About the format and description of <code class="highlighter-rouge">compile_commands.json</code>, you can see <a href="#https://clang.llvm.org/docs/JSONCompilationDatabase.html">JSONCompilationDatabase</a></p>

<h4 id="custom-option-script">Custom option script</h4>

<p>Add some configuration conditions dynamically before option detection:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">option</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">)</span>
    <span class="n">before_check</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">option</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.find_package"</span><span class="p">)</span>
        <span class="n">option</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="n">find_package</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">))</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>Control the detection results of the options by the <code class="highlighter-rouge">on_check</code> script:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">option</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"small"</span><span class="p">)</span>
    <span class="n">set_default</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span>
    <span class="n">on_check</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">option</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">option</span><span class="p">:</span><span class="n">dep</span><span class="p">(</span><span class="s2">"small"</span><span class="p">):</span><span class="n">enabled</span><span class="p">()</span> <span class="k">then</span>
            <span class="n">option</span><span class="p">:</span><span class="n">enable</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span>
        <span class="k">end</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>We can also disable the option after checking option:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">option</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"small"</span><span class="p">)</span>
    <span class="n">add_links</span><span class="p">(</span><span class="s2">"pthread"</span><span class="p">)</span>
    <span class="n">after_check</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">option</span><span class="p">)</span>
        <span class="n">option</span><span class="p">:</span><span class="n">enable</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="custom-target-load-script">Custom Target Load Script</h4>

<p>We can add and modify target configuration dynamically by <code class="highlighter-rouge">target:add</code>, <code class="highlighter-rouge">target:set</code> in the <code class="highlighter-rouge">on_load</code> script.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">on_load</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">target</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="s2">"defines"</span><span class="p">,</span> <span class="s2">"DEBUG"</span><span class="p">,</span> <span class="s2">"TEST=\"</span><span class="n">hello</span><span class="err">\</span><span class="s2">""</span><span class="p">)</span>
        <span class="n">target</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="s2">"linkdirs"</span><span class="p">,</span> <span class="s2">"/usr/lib"</span><span class="p">,</span> <span class="s2">"/usr/local/lib"</span><span class="p">)</span>
        <span class="n">target</span><span class="p">:</span><span class="n">add</span><span class="p">({</span><span class="n">includedirs</span> <span class="o">=</span> <span class="s2">"/usr/include"</span><span class="p">,</span> <span class="s2">"links"</span> <span class="o">=</span> <span class="s2">"pthread"</span><span class="p">})</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="differentiate-platform-and-architecture-for-custom-script">Differentiate platform and architecture for custom script</h4>

<p>For iphoneos platform and arm architecture:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">on_build</span><span class="p">(</span><span class="s2">"iphoneos|arm*"</span><span class="p">,</span> <span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span> 
        <span class="c1">-- TODO</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>For macosx platform and all architecture:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">after_build</span><span class="p">(</span><span class="s2">"macosx"</span><span class="p">,</span> <span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span> 
        <span class="c1">-- TODO</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>For all platform and architecture:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">on_package</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span> 
        <span class="c1">-- TODO</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>并不能对不同架构、平台分别处理。</p>

<h4 id="get-builtin-variable">Get builtin variable</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="nb">print</span><span class="p">(</span><span class="n">val</span><span class="p">(</span><span class="s2">"host"</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">val</span><span class="p">(</span><span class="s2">"env PATH"</span><span class="p">))</span>
<span class="kd">local</span> <span class="n">s</span> <span class="o">=</span> <span class="n">val</span><span class="p">(</span><span class="s2">"shell echo hello"</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="add-includes-and-links-from-target-deps-automatically">Add includes and links from target deps automatically</h4>

<p>We can add <code class="highlighter-rouge">includedirs</code>, <code class="highlighter-rouge">links</code>, <code class="highlighter-rouge">linkdirs</code> and <code class="highlighter-rouge">rpathdirs</code> to target automatically if it’s target deps is <code class="highlighter-rouge">static</code>/<code class="highlighter-rouge">shared</code> library.</p>

<p>Before:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"library1"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"static"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">add_headers</span><span class="p">(</span><span class="s2">"inc1/*.h"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"library2"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"static"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"library1"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">add_headers</span><span class="p">(</span><span class="s2">"inc2/*.h"</span><span class="p">)</span>
    <span class="n">add_includes</span><span class="p">(</span><span class="s2">"$(buildir)/inc1"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"library2"</span><span class="p">)</span>
    <span class="n">add_includes</span><span class="p">(</span><span class="s2">"$(buildirs)/inc2"</span><span class="p">)</span>
    <span class="n">add_links</span><span class="p">(</span><span class="s2">"library2"</span><span class="p">,</span> <span class="s2">"library1"</span><span class="p">)</span>
    <span class="n">add_linkdirs</span><span class="p">(</span><span class="s2">"$(buildir)"</span><span class="p">)</span>
</code></pre>
</div>

<p>Now:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"library1"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"static"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">add_headers</span><span class="p">(</span><span class="s2">"inc1/*.h"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"library2"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"static"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"library1"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">add_headers</span><span class="p">(</span><span class="s2">"inc2/*.h"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"library2"</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="detect-tool">Detect tool</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.find_tool"</span><span class="p">)</span>

<span class="kd">local</span> <span class="n">tool</span> <span class="o">=</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"clang"</span><span class="p">)</span>
<span class="kd">local</span> <span class="n">tool</span> <span class="o">=</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"clang"</span><span class="p">,</span> <span class="p">{</span><span class="n">check</span> <span class="o">=</span> <span class="s2">"--help"</span><span class="p">})</span> 
<span class="kd">local</span> <span class="n">tool</span> <span class="o">=</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"clang"</span><span class="p">,</span> <span class="p">{</span><span class="n">check</span> <span class="o">=</span> <span class="k">function</span> <span class="p">(</span><span class="n">tool</span><span class="p">)</span> <span class="n">os</span><span class="p">.</span><span class="n">run</span><span class="p">(</span><span class="s2">"%s -h"</span><span class="p">,</span> <span class="n">tool</span><span class="p">)</span> <span class="k">end</span><span class="p">})</span>
<span class="kd">local</span> <span class="n">tool</span> <span class="o">=</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"clang"</span><span class="p">,</span> <span class="p">{</span><span class="n">version</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="p">{</span><span class="n">pathes</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"/usr/bin"</span><span class="p">,</span> <span class="s2">"/usr/local/bin"</span><span class="p">,</span> <span class="s2">"$(env PATH)"</span><span class="p">,</span> <span class="k">function</span> <span class="p">()</span> <span class="k">return</span> <span class="s2">"/usr/xxx/bin"</span> <span class="k">end</span><span class="p">}})</span>
</code></pre>
</div>

<h4 id="more-secure-root-permissions-compilation">More Secure Root Permissions compilation</h4>

<p>You can see: <a href="https://github.com/xmake-io/xmake/pull/113">pull#113</a></p>

<h4 id="more-expansion-modules">More expansion Modules</h4>

<p>You can see: <a href="https://github.com/xmake-io/xmake/tree/master/xmake/modules">modules</a></p>

        </article>
        <hr>

        <!-- baidu ads -->
        

        
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="chinese">中文</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/cn/2017/07/29/new-features-v2.1.5/">xmake v2.1.5版本新特性介绍
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
        
            </ul>
        

        
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">Similar Posts</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/2021/12/17/xmake-update-v2.6.2/">Xmake v2.6.2 released, Support building Linux kernel driver module
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 released, Switch to Lua5.4 runtime, Support Rust and C++ mixed compilation
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 released, Improve C++20 Modules and support Nim, Keil MDK and Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 released, Use lockfile to freeze package dependencies and Vala/Metal language support
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>Prev Post</strong> <a href="/2017/05/10/update-v2.1.4/">xmake v2.1.4 released, support REPL</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        

        

        

        
        
        <p><strong>Next Post</strong> <a href="/2017/08/05/update-v2.1.5/">xmake v2.1.5 released, lots of new feature updates</a></p>
        
    </div>
</div>


        <h2 id="comments">Comments</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,      
  language: 'en',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">


            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    Content
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#chinese">中文</a></li>
                    <li><a href="#similar_posts">Similar Posts</a></li>
                    <li><a href="#comments">Comments</a></li>
                </ul>
            </div>

            <!-- baidu ads -->
            

            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    Links
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

            <!-- chitika ads -->
            
        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
